package com.lg.atp.sercurity;


import org.springframework.security.core.context.SecurityContextHolder;

import com.lg.atp.vo.user.UserVo;

public class SecurityUserHolder {

	public static UserVo getCurrentUser() {
		if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication()!=null) {
			Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
			if (!(principal instanceof UserVo)) {
				return null;
			} else {
			}
			return (UserVo) principal;
		}
		return null;
	}

}

